package pers.kui.reader.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import pers.kui.reader.entity.Category;
import pers.kui.reader.mapper.CategoryMapper;
import pers.kui.reader.service.CategoryService;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author liu
 * @date 2021/8/9
 * @apiNote
 */
@Service("categoryService")
/*默认情况下是不需要使用事务的，意味着只读*/
@Transactional(propagation = Propagation.NOT_SUPPORTED ,readOnly = true)
public class CategoryServiceImpl implements CategoryService {
    @Resource
    private CategoryMapper categoryMapper;
    /**查询所有图书分类
    * @return 图书分类List
    */
    @Override
    public List<Category> selectAll() {
        List<Category> list = categoryMapper.selectList(new QueryWrapper<Category>());
        return list;
    }
}
